import 'dart:ui';

import '../constant/my_color.dart';

/// @class : client_order
/// @date : 2023-02-28 15:32
/// @name : LFC
/// @description :客户端订单/报价列表
class ClientOrder {
  num? raw;
  num? total;
  List<Rows>? rows;
  num? code;
  String? msg;

  ClientOrder({this.raw, this.total, this.rows, this.code, this.msg});

  ClientOrder.fromJson(Map<String, dynamic> json) {
    raw = json['raw'];
    total = json['total'];
    if (json['rows'] != null) {
      rows = <Rows>[];
      json['rows'].forEach((v) {
        rows!.add(new Rows.fromJson(v));
      });
    }
    code = json['code'];
    msg = json['msg'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['raw'] = this.raw;
    data['total'] = this.total;
    if (this.rows != null) {
      data['rows'] = this.rows!.map((v) => v.toJson()).toList();
    }
    data['code'] = this.code;
    data['msg'] = this.msg;
    return data;
  }
}

class Rows {
  dynamic searchValue;
  String? createBy;
  String? createTime;
  String? updateBy;
  String? updateTime;
  String? remark;
  Params? params;
  num? quoteId;
  num? projectId;
  String? projectNo;
  String? projectName;
  String? projectImg;
  num? serviceId;
  String? serviceName;
  bool? evaluate;
  bool? commented;
  bool? exhibition;
  num? membersId;
  String? membersNo;
  String? membersName;
  String? memberImage;
  dynamic comUser;
  dynamic serviceEvaluation;
  dynamic addTime;
  num? newQuote;
  String? desCribe;
  String? imgPath;
  String? imagePath;
  String? acceptFlag;
  String? delFlag;
  String? projectState;
  num? version;
  num? newQuoting;//當前報價人數
  num? numberOfPersonsQuoting;//總報價人數

  ///全部訂單的狀態
  String? projectStateStr() {
    if (projectState == "00" || projectState == "01") {
      return "待聘用";
    }
    if (projectState == "02" || projectState == "03") {
      return "已聘用";
    }
    return "";
  }

  ///進行中的訂單狀態
  String? acceptFlagStr() {
    if (acceptFlag == "0") {
      return "待聘用";
    }
    if (acceptFlag == "1") {
      return "已聘用";
    }
    if (acceptFlag == "2") {
      return "未聘用";
    }
    return "";
  }

  Color? allOrderStrColor() {
    if (projectState == "00" || projectState == "01") {
      return MyColors.gary_155155155;
    }
    return MyColors.red_22445100;
  }

  Color? acceptFlagStrColor() {
    if (acceptFlag == "0") {
      return MyColors.red_22445100;
    }
    if (acceptFlag == "1") {
      return MyColors.gary_155155155;
    }
    if (acceptFlag == "2") {
      return MyColors.black_0000011;
    }
    return MyColors.red_22445100;
  }

  Rows(
      {this.searchValue,
      this.createBy,
      this.createTime,
      this.updateBy,
      this.updateTime,
      this.remark,
      this.params,
      this.quoteId,
      this.projectId,
      this.projectNo,
      this.projectName,
      this.projectImg,
      this.serviceId,
      this.serviceName,
      this.evaluate,
      this.commented,
      this.exhibition,
      this.membersId,
      this.membersNo,
      this.membersName,
      this.memberImage,
      this.comUser,
      this.serviceEvaluation,
      this.addTime,
      this.newQuote,
      this.desCribe,
      this.imgPath,
      this.imagePath,
      this.acceptFlag,
      this.delFlag,
      this.projectState,
      this.version,
      this.newQuoting,
      this.numberOfPersonsQuoting
      });

  Rows.fromJson(Map<String, dynamic> json) {
    searchValue = json['searchValue'];
    createBy = json['createBy'];
    createTime = json['createTime'];
    updateBy = json['updateBy'];
    updateTime = json['updateTime'];
    remark = json['remark'];
    params =
        json['params'] != null ? new Params.fromJson(json['params']) : null;
    quoteId = json['quoteId'];
    projectId = json['projectId'];
    projectNo = json['projectNo'];
    projectName = json['projectName'];
    projectImg = json['projectImg'];
    serviceId = json['serviceId'];
    serviceName = json['serviceName'];
    evaluate = json['evaluate'];
    commented = json['commented'];
    exhibition = json['exhibition'];
    membersId = json['membersId'];
    membersNo = json['membersNo'];
    membersName = json['membersName'];
    memberImage = json['memberImage'];
    comUser = json['comUser'];
    serviceEvaluation = json['serviceEvaluation'];
    addTime = json['addTime'];
    newQuote = json['newQuote'];
    desCribe = json['desCribe'];
    imgPath = json['imgPath'];
    imagePath = json['imagePath'];
    acceptFlag = json['acceptFlag'];
    delFlag = json['delFlag'];
    projectState = json['projectState'];
    version = json['version'];
    newQuoting = json['newQuoting'];
    numberOfPersonsQuoting = json['numberOfPersonsQuoting'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['searchValue'] = this.searchValue;
    data['createBy'] = this.createBy;
    data['createTime'] = this.createTime;
    data['updateBy'] = this.updateBy;
    data['updateTime'] = this.updateTime;
    data['remark'] = this.remark;
    if (this.params != null) {
      data['params'] = this.params!.toJson();
    }
    data['quoteId'] = this.quoteId;
    data['projectId'] = this.projectId;
    data['projectNo'] = this.projectNo;
    data['projectName'] = this.projectName;
    data['projectImg'] = this.projectImg;
    data['serviceId'] = this.serviceId;
    data['serviceName'] = this.serviceName;
    data['evaluate'] = this.evaluate;
    data['commented'] = this.commented;
    data['exhibition'] = this.exhibition;
    data['membersId'] = this.membersId;
    data['membersNo'] = this.membersNo;
    data['membersName'] = this.membersName;
    data['memberImage'] = this.memberImage;
    data['comUser'] = this.comUser;
    data['serviceEvaluation'] = this.serviceEvaluation;
    data['addTime'] = this.addTime;
    data['newQuote'] = this.newQuote;
    data['desCribe'] = this.desCribe;
    data['imgPath'] = this.imgPath;
    data['imagePath'] = this.imagePath;
    data['acceptFlag'] = this.acceptFlag;
    data['delFlag'] = this.delFlag;
    data['projectState'] = this.projectState;
    data['version'] = this.version;
    data['newQuoting'] = this.newQuoting;
    data['numberOfPersonsQuoting'] = this.numberOfPersonsQuoting;
    return data;
  }
}

class Params {
  Params();

  Params.fromJson(Map<String, dynamic> json) {}

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    return data;
  }
}
